// @charset "utf-8";
/**
 * resetSize重置尺寸强弱评级
 */
define(function (require, exports, module) {
	var qrpjChart = require('../qrpj/qrpjchart.js');
	var qrpjreadChart = require('../qrpj/qrpjreadchart.js');
	var dqfxChart = require('../qrpj/dqfxchart.js');
	var resetSizeFun = {
		init : function () {
			var self = this;
			self.resetSize();
			// $(window).on('resize', function () {
			// 	self.resetSize();
			// });
			$(window).resize(self.resizeDebounce(self.resetSize, 200));

		},
		resetSize : function () {
			var windowWidth = $(window).width(),
				windowHeight = $(window).height();
			$('.container').height(windowHeight).width(windowWidth);
			$('.tab-content-item').height(windowHeight - 26);
			$('.chart-content, .chart-c').height(windowHeight - 26 - 15)
				.width(windowWidth - 4);

			// $('#view_div_dqfxchart').height(windowHeight - 26 - 5);

			$('.reading-content').height(windowHeight - 30)
				.width(windowWidth - 4);

			var readChartWidth = (windowWidth - 22) * 0.4;
			$('#view_div_readchart').height(readChartWidth * 0.7)
				.width(readChartWidth);

			// xgsg
			$('.xgsg-content').height(windowHeight - 26).width(windowWidth - 10);
			$('.data-box').height(windowHeight - 26 - 28 - 17);

			qrpjChart.reflowChart();
			qrpjreadChart.reflowChart();
			dqfxChart.reflowChart();

		},

		resizeTimer : null,
		resizeDebounce : function (callback, delay, context) {
			var self = this;
			context = context || this;
			return function() {
				clearTimeout(self.resizeTimer);
				self.resizeTimer = setTimeout(function() {
					callback.apply(context, arguments);
				}, delay || 100);
			};
		}
	};

	module.exports = resetSizeFun;
});